Data Read In

CSLAP<-read.csv("CSLAP_Dataset_09232019.csv", header=TRUE)
CSLAP$Sample_Year<-as.factor(CSLAP$Sample_Year)
CSLAP$Sample_Month<-as.factor(CSLAP$Sample_Month)

#Split by `Info_Type`
OWCSLAP<-CSLAP[CSLAP$Info_Type == "OW",]
BSCSLAP<-CSLAP[CSLAP$Info_Type == "BS",]
SBCSLAP<-CSLAP[CSLAP$Info_Type == "SB",]
noSBCSLAP<-CSLAP[CSLAP$Info_Type != "SB",]

redCSLAP<-read.csv("redCSLAP.csv")

redOWCSLAP<-redCSLAP[redCSLAP$Info_Type == "OW",]
redBSCSLAP<-redCSLAP[redCSLAP$Info_Type == "BS",]
redSBCSLAP<-redCSLAP[redCSLAP$Info_Type == "SB",]
rednoSBCSLAP<-redCSLAP[redCSLAP$Info_Type != "SB",]

Gamma(link=“identity”) models for the Global Dataset (n=69)

Open Water Total Phosphorus

Remove troublesome LakeID and Sample_Year

#Select out data of interest
df <- OWCSLAP %>% dplyr::select(TP_mg.L, Dreissenids, CA.SA, Mean_Depth_m, Sample_Year, Sample_Month, LakeID)
df <- df[complete.cases(df), ]

#Remove lakes and year 2015
df <- df[df$LakeID != "0601GUI0188",]
df <- df[df$LakeID != "1201ECA0697", ]
df <- df[df$LakeID != "1701LLO0708", ]
df <- df[df$LakeID != "1201GAL0563", ]
df <- df[df$Sample_Year != "2015",]
df$LakeID <- as.factor(as.character(df$LakeID))
OWTP<-glm(TP_mg.L+1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=df, family=Gamma(link="identity"))

summary(OWTP)
## 
## Call:
## glm(formula = TP_mg.L + 1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), 
##     family = Gamma(link = "identity"), data = df)
## 
## Deviance Residuals: 
##       Min         1Q     Median         3Q        Max  
## -0.010728  -0.003571  -0.001395   0.001973   0.061486  
## 
## Coefficients:
##                        Estimate Std. Error  t value Pr(>|t|)    
## (Intercept)           1.0164616  0.0005768 1762.377  < 2e-16 ***
## DreissenidsUninvaded -0.0022936  0.0003926   -5.842 5.95e-09 ***
## log(CA.SA)            0.0002040  0.0001271    1.605    0.109    
## log(Mean_Depth_m)    -0.0023559  0.0002034  -11.585  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 3.55969e-05)
## 
##     Null deviance: 0.079669  on 2113  degrees of freedom
## Residual deviance: 0.074080  on 2110  degrees of freedom
## AIC: -15632
## 
## Number of Fisher Scoring iterations: 3
plot(OWTP)

qqPlot(resid(OWTP))

## 3989  123 
## 1714   58
simOWTP  <-  simulateResiduals(OWTP)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simOWTP) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Bottom Sample TP

BSTP<-glm(TP_mg.L+1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=BSCSLAP, family=Gamma(link="identity"))

summary(BSTP)
## 
## Call:
## glm(formula = TP_mg.L + 1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), 
##     family = Gamma(link = "identity"), data = BSCSLAP)
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -0.07956  -0.04778  -0.02916  -0.00214   2.01241  
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           1.058383   0.016518  64.076  < 2e-16 ***
## DreissenidsUninvaded  0.020215   0.009781   2.067   0.0389 *  
## log(CA.SA)            0.015291   0.003504   4.364 1.35e-05 ***
## log(Mean_Depth_m)    -0.031107   0.007766  -4.006 6.43e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 0.02022613)
## 
##     Null deviance: 22.032  on 1846  degrees of freedom
## Residual deviance: 21.421  on 1843  degrees of freedom
##   (104 observations deleted due to missingness)
## AIC: -2807.5
## 
## Number of Fisher Scoring iterations: 5
plot(BSTP)

qqPlot(resid(BSTP))

## 20 31 
## 10 16
simBSTP  <-  simulateResiduals(BSTP)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simBSTP) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Open Water TN

OWTN<-glm(TN_mg.L+1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=OWCSLAP, family=Gamma(link="identity"))

summary(OWTN)
## 
## Call:
## glm(formula = TN_mg.L + 1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), 
##     family = Gamma(link = "identity"), data = OWCSLAP)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.3947  -0.1060  -0.0449   0.0285   3.7172  
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           1.549277   0.037903  40.875  < 2e-16 ***
## DreissenidsUninvaded -0.142040   0.027153  -5.231 1.82e-07 ***
## log(CA.SA)            0.019655   0.007835   2.509 0.012182 *  
## log(Mean_Depth_m)    -0.043181   0.012570  -3.435 0.000601 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 0.08901886)
## 
##     Null deviance: 104.31  on 2684  degrees of freedom
## Residual deviance: 100.16  on 2681  degrees of freedom
##   (67 observations deleted due to missingness)
## AIC: 517.16
## 
## Number of Fisher Scoring iterations: 6
plot(OWTN)

qqPlot(resid(OWTN))

## 4237  271 
## 2294  141
simOWTN  <-  simulateResiduals(OWTN)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simOWTN) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Open Water Chlorophyll-a

OWChl<-glm(Extracted_Chl.a_ug.L+.01 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=OWCSLAP, family=Gamma(link="identity"))

summary(OWChl)
## 
## Call:
## glm(formula = Extracted_Chl.a_ug.L + 0.01 ~ Dreissenids + log(CA.SA) + 
##     log(Mean_Depth_m), family = Gamma(link = "identity"), data = OWCSLAP)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.6840  -0.7151  -0.3112   0.1963   4.5504  
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           3.92702    0.25152  15.613  < 2e-16 ***
## DreissenidsUninvaded  0.71415    0.15490   4.610 4.21e-06 ***
## log(CA.SA)            0.15724    0.05482   2.868  0.00416 ** 
## log(Mean_Depth_m)    -1.02768    0.10569  -9.724  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 1.013149)
## 
##     Null deviance: 1938.2  on 2636  degrees of freedom
## Residual deviance: 1827.7  on 2633  degrees of freedom
##   (115 observations deleted due to missingness)
## AIC: 11139
## 
## Number of Fisher Scoring iterations: 8
plot(OWChl)

qqPlot(resid(OWChl))

##   60 1644 
##   29  810
simOWChl  <-  simulateResiduals(OWChl)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simOWChl) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Secchi Depth

OWSecchi<-glm(Secchi_Depth_m ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=OWCSLAP, family=Gamma(link="identity"))

summary(OWSecchi)
## 
## Call:
## glm(formula = Secchi_Depth_m ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), 
##     family = Gamma(link = "identity"), data = OWCSLAP)
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -1.24637  -0.27292  -0.04745   0.18312   1.33146  
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           3.21666    0.11972  26.867  < 2e-16 ***
## DreissenidsUninvaded -0.29053    0.09374  -3.099  0.00196 ** 
## log(CA.SA)           -0.26453    0.02623 -10.085  < 2e-16 ***
## log(Mean_Depth_m)     1.09994    0.02847  38.640  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 0.1186655)
## 
##     Null deviance: 427.44  on 2632  degrees of freedom
## Residual deviance: 312.56  on 2629  degrees of freedom
##   (119 observations deleted due to missingness)
## AIC: 8959.9
## 
## Number of Fisher Scoring iterations: 6
plot(OWSecchi)

qqPlot(resid(OWSecchi))

## 4432  368 
## 2359  171
simOWSecchi  <-  simulateResiduals(OWSecchi)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simOWSecchi) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

True Color

OWTC<-glm(True_Color_PTU ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=OWCSLAP, family=Gamma(link="identity"))

summary(OWTC)
## 
## Call:
## glm(formula = True_Color_PTU ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), 
##     family = Gamma(link = "identity"), data = OWCSLAP)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.2571  -0.5533  -0.1622   0.2630   2.2626  
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           15.1038     0.8208  18.401  < 2e-16 ***
## DreissenidsUninvaded   2.0558     0.5100   4.031 5.71e-05 ***
## log(CA.SA)             1.8840     0.1784  10.562  < 2e-16 ***
## log(Mean_Depth_m)     -3.6529     0.3203 -11.404  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 0.4162008)
## 
##     Null deviance: 1179.3  on 2655  degrees of freedom
## Residual deviance: 1064.0  on 2652  degrees of freedom
##   (96 observations deleted due to missingness)
## AIC: 18653
## 
## Number of Fisher Scoring iterations: 12
plot(OWTC)

qqPlot(resid(OWTC))

## 1174 3254 
##  571 1729
simOWTC  <-  simulateResiduals(OWTC)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simOWTC) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Shoreline Bloom Chlorophyll

SBChl<-glm(ESF_Chl.a_ug.L+1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=SBCSLAP, family=Gamma(link="identity"))
## Warning: glm.fit: algorithm did not converge
summary(SBChl)
## 
## Call:
## glm(formula = ESF_Chl.a_ug.L + 1 ~ Dreissenids + log(CA.SA) + 
##     log(Mean_Depth_m), family = Gamma(link = "identity"), data = SBCSLAP)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -3.6258  -2.4781  -1.8809  -0.7808   6.3404  
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)  
## (Intercept)            4526.0     2591.3   1.747   0.0821 .
## DreissenidsUninvaded    500.3      924.5   0.541   0.5889  
## log(CA.SA)              635.3      755.8   0.841   0.4015  
## log(Mean_Depth_m)     -2210.1     1152.2  -1.918   0.0564 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 11.10688)
## 
##     Null deviance: 1163.9  on 223  degrees of freedom
## Residual deviance: 1140.7  on 220  degrees of freedom
##   (2 observations deleted due to missingness)
## AIC: 3518.4
## 
## Number of Fisher Scoring iterations: 25
plot(SBChl)

qqPlot(resid(SBChl))

## 1115 1089 
##   73   63
simSBChl  <-  simulateResiduals(SBChl)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simSBChl) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Shoreline Bloom Microcystin

SBmicro<-glm(ESF_Microcystin_ug.L+1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=SBCSLAP, family=Gamma(link="identity"))
## Warning in log(ifelse(y == 0, 1, y/mu)): NaNs produced
## Warning: step size truncated due to divergence
## Warning in log(ifelse(y == 0, 1, y/mu)): NaNs produced

## Warning in log(ifelse(y == 0, 1, y/mu)): NaNs produced

## Warning in log(ifelse(y == 0, 1, y/mu)): NaNs produced

## Warning in log(ifelse(y == 0, 1, y/mu)): NaNs produced

## Warning in log(ifelse(y == 0, 1, y/mu)): NaNs produced

## Warning in log(ifelse(y == 0, 1, y/mu)): NaNs produced

## Warning in log(ifelse(y == 0, 1, y/mu)): NaNs produced

## Warning in log(ifelse(y == 0, 1, y/mu)): NaNs produced
## Warning: glm.fit: algorithm did not converge
summary(SBmicro)
## 
## Call:
## glm(formula = ESF_Microcystin_ug.L + 1 ~ Dreissenids + log(CA.SA) + 
##     log(Mean_Depth_m), family = Gamma(link = "identity"), data = SBCSLAP)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -3.5620  -2.0461  -1.1396   0.0506   4.5952  
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)  
## (Intercept)              2143       1240   1.728   0.0914 .
## DreissenidsUninvaded     3093       1611   1.919   0.0617 .
## log(CA.SA)              -2630       1391  -1.890   0.0656 .
## log(Mean_Depth_m)        1575       1030   1.529   0.1337  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 5.364112)
## 
##     Null deviance: 259.73  on 45  degrees of freedom
## Residual deviance: 161.20  on 42  degrees of freedom
##   (180 observations deleted due to missingness)
## AIC: 614.36
## 
## Number of Fisher Scoring iterations: 25
plot(SBmicro)

qqPlot(resid(SBmicro))

## 1100  629 
##   32   15
simSBmicro  <-  simulateResiduals(SBmicro)
plotSimulatedResiduals(simSBmicro) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Gamma(link=“log”) models for the Global Dataset (n=69)

Open Water Total Phosphorus

OWTP2<-glm(TP_mg.L+1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=df, family=Gamma(link="log"))

summary(OWTP2)
## 
## Call:
## glm(formula = TP_mg.L + 1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), 
##     family = Gamma(link = "log"), data = df)
## 
## Deviance Residuals: 
##       Min         1Q     Median         3Q        Max  
## -0.010727  -0.003570  -0.001394   0.001973   0.061488  
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           0.0163358  0.0005701  28.653  < 2e-16 ***
## DreissenidsUninvaded -0.0022666  0.0003878  -5.845 5.86e-09 ***
## log(CA.SA)            0.0002013  0.0001258   1.601     0.11    
## log(Mean_Depth_m)    -0.0023277  0.0002009 -11.585  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 3.55984e-05)
## 
##     Null deviance: 0.079669  on 2113  degrees of freedom
## Residual deviance: 0.074083  on 2110  degrees of freedom
## AIC: -15631
## 
## Number of Fisher Scoring iterations: 3
plot(OWTP2)

qqPlot(resid(OWTP2))

## 3989  123 
## 1714   58
simOWTP2  <-  simulateResiduals(OWTP2)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simOWTP2) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Bottom Sample TP

BSTP2<-glm(TP_mg.L+1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=BSCSLAP, family=Gamma(link="log"))

summary(BSTP2)
## 
## Call:
## glm(formula = TP_mg.L + 1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), 
##     family = Gamma(link = "log"), data = BSCSLAP)
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -0.08022  -0.04780  -0.02898  -0.00191   2.01106  
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           0.056030   0.015708   3.567  0.00037 ***
## DreissenidsUninvaded  0.019628   0.009378   2.093  0.03649 *  
## log(CA.SA)            0.014847   0.003336   4.451 9.05e-06 ***
## log(Mean_Depth_m)    -0.029833   0.007365  -4.050 5.32e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 0.02019946)
## 
##     Null deviance: 22.032  on 1846  degrees of freedom
## Residual deviance: 21.411  on 1843  degrees of freedom
##   (104 observations deleted due to missingness)
## AIC: -2808.4
## 
## Number of Fisher Scoring iterations: 4
plot(BSTP2)

qqPlot(resid(BSTP2))

## 20 31 
## 10 16
simBSTP2  <-  simulateResiduals(BSTP2)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simBSTP2) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Open Water TN

OWTN2<-glm(TN_mg.L+1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=OWCSLAP, family=Gamma(link="log"))

summary(OWTN2)
## 
## Call:
## glm(formula = TN_mg.L + 1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), 
##     family = Gamma(link = "log"), data = OWCSLAP)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.3962  -0.1056  -0.0448   0.0284   3.7210  
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           0.435499   0.026146  16.657  < 2e-16 ***
## DreissenidsUninvaded -0.098875   0.018091  -5.465 5.05e-08 ***
## log(CA.SA)            0.015820   0.005609   2.821 0.004828 ** 
## log(Mean_Depth_m)    -0.030536   0.008914  -3.426 0.000622 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 0.0890692)
## 
##     Null deviance: 104.31  on 2684  degrees of freedom
## Residual deviance: 100.06  on 2681  degrees of freedom
##   (67 observations deleted due to missingness)
## AIC: 514.5
## 
## Number of Fisher Scoring iterations: 4
plot(OWTN2)

qqPlot(resid(OWTN2))

## 4237  271 
## 2294  141
simOWTN2  <-  simulateResiduals(OWTN2)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simOWTN2) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Open Water Chlorophyll-a

OWChl2<-glm(Extracted_Chl.a_ug.L+.01 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=OWCSLAP, family=Gamma(link="log"))

summary(OWChl2)
## 
## Call:
## glm(formula = Extracted_Chl.a_ug.L + 0.01 ~ Dreissenids + log(CA.SA) + 
##     log(Mean_Depth_m), family = Gamma(link = "log"), data = OWCSLAP)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.7084  -0.7178  -0.3104   0.1996   4.5537  
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           1.20915    0.08989  13.451  < 2e-16 ***
## DreissenidsUninvaded  0.27980    0.06159   4.543  5.8e-06 ***
## log(CA.SA)            0.05457    0.01925   2.835  0.00462 ** 
## log(Mean_Depth_m)    -0.26078    0.03038  -8.583  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 1.010626)
## 
##     Null deviance: 1938.2  on 2636  degrees of freedom
## Residual deviance: 1835.2  on 2633  degrees of freedom
##   (115 observations deleted due to missingness)
## AIC: 11151
## 
## Number of Fisher Scoring iterations: 5
plot(OWChl2)

qqPlot(resid(OWChl2))

##   60 1644 
##   29  810
simOWChl2  <-  simulateResiduals(OWChl2)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simOWChl2) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Secchi Depth

OWSecchi2<-glm(Secchi_Depth_m ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=OWCSLAP, family=Gamma(link="log"))

summary(OWSecchi2)
## 
## Call:
## glm(formula = Secchi_Depth_m ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), 
##     family = Gamma(link = "log"), data = OWCSLAP)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.2639  -0.2661  -0.0516   0.1866   1.3115  
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           1.149878   0.030371  37.861  < 2e-16 ***
## DreissenidsUninvaded -0.077716   0.020945  -3.711 0.000211 ***
## log(CA.SA)           -0.086146   0.006593 -13.066  < 2e-16 ***
## log(Mean_Depth_m)     0.318868   0.010555  30.211  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 0.1188637)
## 
##     Null deviance: 427.44  on 2632  degrees of freedom
## Residual deviance: 311.91  on 2629  degrees of freedom
##   (119 observations deleted due to missingness)
## AIC: 8954.3
## 
## Number of Fisher Scoring iterations: 4
plot(OWSecchi2)

qqPlot(resid(OWSecchi2))

## 4432  368 
## 2359  171
simOWSecchi2  <-  simulateResiduals(OWSecchi2)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simOWSecchi2) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

True Color

OWTC2<-glm(True_Color_PTU ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=OWCSLAP, family=Gamma(link="log"))

summary(OWTC2)
## 
## Call:
## glm(formula = True_Color_PTU ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), 
##     family = Gamma(link = "log"), data = OWCSLAP)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.2588  -0.5467  -0.1512   0.2657   2.2738  
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           2.63403    0.05677  46.401  < 2e-16 ***
## DreissenidsUninvaded  0.15040    0.03920   3.837 0.000128 ***
## log(CA.SA)            0.13774    0.01219  11.296  < 2e-16 ***
## log(Mean_Depth_m)    -0.23044    0.01927 -11.959  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 0.4126261)
## 
##     Null deviance: 1179.3  on 2655  degrees of freedom
## Residual deviance: 1057.2  on 2652  degrees of freedom
##   (96 observations deleted due to missingness)
## AIC: 18635
## 
## Number of Fisher Scoring iterations: 7
plot(OWTC2)

qqPlot(resid(OWTC2))

## 1174 1323 
##  571  647
simOWTC2  <-  simulateResiduals(OWTC2)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simOWTC2) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Shoreline Bloom Chlorophyll

SBChl2<-glm(ESF_Chl.a_ug.L+1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=SBCSLAP, family=Gamma(link="log"))
## Warning: glm.fit: algorithm did not converge
summary(SBChl2)
## 
## Call:
## glm(formula = ESF_Chl.a_ug.L + 1 ~ Dreissenids + log(CA.SA) + 
##     log(Mean_Depth_m), family = Gamma(link = "log"), data = SBCSLAP)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -3.5090  -2.5512  -1.8732  -0.7115   6.5521  
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           9.11707    0.94182   9.680  < 2e-16 ***
## DreissenidsUninvaded  0.09243    0.48142   0.192  0.84793    
## log(CA.SA)            0.13311    0.29358   0.453  0.65072    
## log(Mean_Depth_m)    -1.05893    0.38415  -2.757  0.00633 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 9.766356)
## 
##     Null deviance: 1163.9  on 223  degrees of freedom
## Residual deviance: 1137.1  on 220  degrees of freedom
##   (2 observations deleted due to missingness)
## AIC: 3517.4
## 
## Number of Fisher Scoring iterations: 25
plot(SBChl2)

qqPlot(resid(SBChl2))

## 1115 1089 
##   73   63
simSBChl2  <-  simulateResiduals(SBChl2)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simSBChl2) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Shoreline Bloom Microcystin

SBmicro2<-glm(ESF_Microcystin_ug.L+1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=SBCSLAP, family=Gamma(link="log"))
## Warning: glm.fit: algorithm did not converge
summary(SBmicro2)
## 
## Call:
## glm(formula = ESF_Microcystin_ug.L + 1 ~ Dreissenids + log(CA.SA) + 
##     log(Mean_Depth_m), family = Gamma(link = "log"), data = SBCSLAP)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -20.713  -13.707   -8.175   -2.534    4.839  
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          -353.9838     4.6022  -76.92   <2e-16 ***
## DreissenidsUninvaded -134.5380     0.9398 -143.16   <2e-16 ***
## log(CA.SA)            182.1964     1.8263   99.76   <2e-16 ***
## log(Mean_Depth_m)     127.1322     1.6808   75.64   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 5.934985)
## 
##     Null deviance:  259.73  on 45  degrees of freedom
## Residual deviance: 4945.56  on 42  degrees of freedom
##   (180 observations deleted due to missingness)
## AIC: 884.24
## 
## Number of Fisher Scoring iterations: 25
plot(SBmicro2)

qqPlot(resid(SBmicro2))

## 1100 1015 
##   32   20
simSBmicro2  <-  simulateResiduals(SBmicro2)
plotSimulatedResiduals(simSBmicro2) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Gamma(link=“inverse”) models for the Global Dataset (n=69)

Open Water Total Phosphorus

OWTP3<-glm(TP_mg.L+1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=df, family=Gamma(link="inverse"))

summary(OWTP3)
## 
## Call:
## glm(formula = TP_mg.L + 1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), 
##     family = Gamma(link = "inverse"), data = df)
## 
## Deviance Residuals: 
##       Min         1Q     Median         3Q        Max  
## -0.010726  -0.003570  -0.001393   0.001974   0.061490  
## 
## Coefficients:
##                        Estimate Std. Error  t value Pr(>|t|)    
## (Intercept)           0.9837887  0.0005636 1745.641  < 2e-16 ***
## DreissenidsUninvaded  0.0022399  0.0003831    5.847 5.78e-09 ***
## log(CA.SA)           -0.0001987  0.0001245   -1.597     0.11    
## log(Mean_Depth_m)     0.0022999  0.0001985   11.586  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 3.559991e-05)
## 
##     Null deviance: 0.079669  on 2113  degrees of freedom
## Residual deviance: 0.074086  on 2110  degrees of freedom
## AIC: -15631
## 
## Number of Fisher Scoring iterations: 3
plot(OWTP3)

qqPlot(resid(OWTP3))

## 3989  123 
## 1714   58
simOWTP3  <-  simulateResiduals(OWTP3)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simOWTP3) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Bottom Sample TP

BSTP3<-glm(TP_mg.L+1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=BSCSLAP, family=Gamma(link="inverse"))

summary(BSTP3)
## 
## Call:
## glm(formula = TP_mg.L + 1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), 
##     family = Gamma(link = "inverse"), data = BSCSLAP)
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -0.08091  -0.04792  -0.02870  -0.00170   2.00964  
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           0.946228   0.014934  63.361  < 2e-16 ***
## DreissenidsUninvaded -0.019071   0.008993  -2.121   0.0341 *  
## log(CA.SA)           -0.014419   0.003174  -4.543 5.91e-06 ***
## log(Mean_Depth_m)     0.028615   0.006981   4.099 4.33e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 0.02017152)
## 
##     Null deviance: 22.032  on 1846  degrees of freedom
## Residual deviance: 21.401  on 1843  degrees of freedom
##   (104 observations deleted due to missingness)
## AIC: -2809.2
## 
## Number of Fisher Scoring iterations: 4
plot(BSTP3)

qqPlot(resid(BSTP3))

## 20 31 
## 10 16
simBSTP3  <-  simulateResiduals(BSTP3)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simBSTP3) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Open Water TN

OWTN3<-glm(TN_mg.L+1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=OWCSLAP, family=Gamma(link="inverse"))

summary(OWTN3)
## 
## Call:
## glm(formula = TN_mg.L + 1 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), 
##     family = Gamma(link = "inverse"), data = OWCSLAP)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.3984  -0.1056  -0.0449   0.0290   3.7254  
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           0.649279   0.018026  36.019  < 2e-16 ***
## DreissenidsUninvaded  0.069149   0.012054   5.737 1.07e-08 ***
## log(CA.SA)           -0.012774   0.003984  -3.206 0.001362 ** 
## log(Mean_Depth_m)     0.021516   0.006297   3.417 0.000643 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 0.08911749)
## 
##     Null deviance: 104.31  on 2684  degrees of freedom
## Residual deviance:  99.93  on 2681  degrees of freedom
##   (67 observations deleted due to missingness)
## AIC: 511.07
## 
## Number of Fisher Scoring iterations: 5
plot(OWTN3)

qqPlot(resid(OWTN3))

## 4237  271 
## 2294  141
simOWTN3  <-  simulateResiduals(OWTN3)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simOWTN3) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Open Water Chlorophyll-a

OWChl3<-glm(Extracted_Chl.a_ug.L+.01 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=OWCSLAP, family=Gamma(link="inverse"))

summary(OWChl3)
## 
## Call:
## glm(formula = Extracted_Chl.a_ug.L + 0.01 ~ Dreissenids + log(CA.SA) + 
##     log(Mean_Depth_m), family = Gamma(link = "inverse"), data = OWCSLAP)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.7074  -0.7178  -0.3073   0.1980   4.5255  
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           0.361262   0.031100  11.616  < 2e-16 ***
## DreissenidsUninvaded -0.108103   0.025051  -4.315 1.65e-05 ***
## log(CA.SA)           -0.018969   0.005897  -3.217  0.00131 ** 
## log(Mean_Depth_m)     0.058955   0.007364   8.006 1.76e-15 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 1.007162)
## 
##     Null deviance: 1938.2  on 2636  degrees of freedom
## Residual deviance: 1843.5  on 2633  degrees of freedom
##   (115 observations deleted due to missingness)
## AIC: 11164
## 
## Number of Fisher Scoring iterations: 7
plot(OWChl3)

qqPlot(resid(OWChl3))

##   60 1644 
##   29  810
simOWChl3  <-  simulateResiduals(OWChl3)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simOWChl3) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Secchi Depth

OWSecchi3<-glm(Secchi_Depth_m ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=OWCSLAP, family=Gamma(link="inverse"))

summary(OWSecchi3)
## 
## Call:
## glm(formula = Secchi_Depth_m ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), 
##     family = Gamma(link = "inverse"), data = OWCSLAP)
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -1.26170  -0.27334  -0.05502   0.18845   1.32723  
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           0.307871   0.007093  43.402  < 2e-16 ***
## DreissenidsUninvaded  0.020455   0.004645   4.404 1.11e-05 ***
## log(CA.SA)            0.022983   0.001510  15.222  < 2e-16 ***
## log(Mean_Depth_m)    -0.078289   0.002811 -27.854  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 0.1203673)
## 
##     Null deviance: 427.44  on 2632  degrees of freedom
## Residual deviance: 315.20  on 2629  degrees of freedom
##   (119 observations deleted due to missingness)
## AIC: 8982.5
## 
## Number of Fisher Scoring iterations: 5
plot(OWSecchi3)

qqPlot(resid(OWSecchi3))

## 4432  368 
## 2359  171
simOWSecchi3  <-  simulateResiduals(OWSecchi3)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simOWSecchi3) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

True Color

OWTC3<-glm(True_Color_PTU ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=OWCSLAP, family=Gamma(link="inverse"))

summary(OWTC3)
## 
## Call:
## glm(formula = True_Color_PTU ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), 
##     family = Gamma(link = "inverse"), data = OWCSLAP)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.2644  -0.5599  -0.1380   0.2560   2.2384  
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           0.0782548  0.0038001  20.593  < 2e-16 ***
## DreissenidsUninvaded -0.0108886  0.0029502  -3.691 0.000228 ***
## log(CA.SA)           -0.0094469  0.0007224 -13.077  < 2e-16 ***
## log(Mean_Depth_m)     0.0129348  0.0009760  13.253  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Gamma family taken to be 0.4099815)
## 
##     Null deviance: 1179.3  on 2655  degrees of freedom
## Residual deviance: 1052.3  on 2652  degrees of freedom
##   (96 observations deleted due to missingness)
## AIC: 18622
## 
## Number of Fisher Scoring iterations: 6
plot(OWTC3)

qqPlot(resid(OWTC3))

## 1174 1323 
##  571  647
simOWTC3  <-  simulateResiduals(OWTC3)
## Model family was recognized or set as continuous, but duplicate values were detected in the response. Consider if you are fitting an appropriate model.
plotSimulatedResiduals(simOWTC3) 
## plotSimulatedResiduals is deprecated, switch your code to using the plot function

Shoreline Bloom Chlorophyll

`Model won’t run

SBChl3<-glm(ESF_Chl.a_ug.L+.01 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=SBCSLAP, family=Gamma(link="inverse"))

summary(SBChl3)

plot(SBChl3)

qqPlot(resid(SBChl3))

simSBChl3  <-  simulateResiduals(SBChl3)
plotSimulatedResiduals(simSBChl3) 

Shoreline Bloom Microcystin

`Model won’t run

SBmicro3<-glm(ESF_Microcystin_ug.L+.01 ~ Dreissenids + log(CA.SA) + log(Mean_Depth_m), data=SBCSLAP, family=Gamma(link="inverse"))

summary(SBmicro3)

plot(SBmicro3)

qqPlot(resid(SBmicro3))

simSBmicro3  <-  simulateResiduals(SBmicro3)
plotSimulatedResiduals(simSBmicro3)